import config from '@/configs/index.js'
export const layoutComponents = [
  {
    type: 'layouttable',
    name: '列布局',
    icon: 'el-icon-s-grid',
    options: {
      title: '列布局',
      IsShowTitle: false,
      idPrefix: 'pnf_',
      controlId: '',
      tagattr: '',
      ishide: false,
      lg: 24,
      md: 24,
      xs: 24,
      planelist: [
        {
          id: 'collapse1',
          title: '列1',
          tagattr: '',
          columns: [],
          ishide: false,
          scalewidth: 20,
          phonescalewidth: 20,
          ipadscalewidth: 20,
        },
        {
          id: 'collapse2',
          title: '列2',
          tagattr: '',
          columns: [],
          ishide: false,
          scalewidth: 20,
          phonescalewidth: 20,
          ipadscalewidth: 20,
        },
        {
          id: 'collapse3',
          title: '列3',
          tagattr: '',
          columns: [],
          ishide: false,
          scalewidth: 20,
          phonescalewidth: 20,
          ipadscalewidth: 20,
        },
        {
          id: 'collapse4',
          title: '列4',
          tagattr: '',
          columns: [],
          ishide: false,
          scalewidth: 20,
          phonescalewidth: 20,
          ipadscalewidth: 20,
        },
        {
          id: 'collapse5',
          title: '列5',
          tagattr: '',
          columns: [],
          ishide: false,
          scalewidth: 20,
          phonescalewidth: 20,
          ipadscalewidth: 20,
        },
      ],
    },
  },
  {
    type: 'gridPanel',
    name: '模块布局',
    icon: 'el-icon-s-grid',
    options: {
      title: '模块布局',
      istitle: true,
      icon: 'el-icon-share',
      idPrefix: 'pnl_',
      controlId: '',
      tagattr: '',
      ishide: false,
      lg: 24,
      md: 24,
      xs: 24,
      columns: [],
    },
  },
  {
    type: 'tabs',
    name: 'tab布局',
    icon: 'fa fa-tags',
    options: {
      title: '',
      idPrefix: 'tab_',
      controlId: '',
      tagattr: '',
      ishide: false,
      lg: 24,
      md: 24,
      xs: 24,
      planelist: [
        {
          name: 'tab1',
          title: '用户管理',
          icon: 'el-icon-date',
          tagattr: '',
          columns: [],
          ishide: false,
        },
      ],
    },
  },
  {
    type: 'collapse',
    name: '折叠面板布局',
    icon: 'fa fa-tasks',
    options: {
      idPrefix: 'coll_',
      tagattr: '',
      title: '',
      ishide: false,
      lg: 24,
      md: 24,
      xs: 24,
      planelist: [
        {
          name: 'tab1',
          title: '用户管理',
          icon: 'el-icon-date',
          tagattr: '',
          columns: [],
          ishide: false,
        },
      ],
    },
  },
  {
    type: 'stepslayout',
    name: '步骤布局',
    icon: 'fa fa-tasks',
    options: {
      idPrefix: 'coll_',
      tagattr: '',
      title: '',
      ishide: false,
      lg: 24,
      md: 24,
      xs: 24,
      planelist: [
        {
          title: '步骤1',
          icon: 'el-icon-date',
          tagattr: '',
          columns: [],
          ishide: false,
        },
      ],
    },
  },
]
export const basicComponents = [
  {
    type: 'fromlable',
    name: 'Lable标签',
    icon: 'fa fa-text-width',
    options: {
      title: 'Lable标签',
      filed: '',
      defaultValue: '',
      lg: 8,
      md: 12,
      xs: 24,
      tagattr: '',
      labelwidth: 80,
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'component',
    name: '自定义组件',
    icon: 'fa fa-code',
    options: {
      title: '自定义组件',
      filed: '',
      defaultValue: '',
      lg: 8,
      md: 12,
      xs: 24,
      tagattr: '',
      component: '',
      labelwidth: 80,
      parenttagattr: '',
      ishide: false,
      istitle: false,
    },
  },
  {
    type: 'hidden',
    name: '隐藏文本',
    icon: 'fa fa-eye-slash',
    options: {
      title: '隐藏文本',
      filed: '',
      labelwidth: 80,
      defaultValue: '',
      lg: 8,
      md: 12,
      xs: 24,
      tagattr: '',
      parenttagattr: '',
    },
  },
  {
    type: 'input',
    name: '单行文本',
    icon: 'fa fa-text-width',
    options: {
      eventlist: [],
      title: '单行文本',
      defaultValue: '',
      placeholder: '',
      dataType: 'string',
      dataLength: '50',
      lg: 8,
      md: 12,
      xs: 24,
      labelwidth: 80,
      filed: '',
      required: false,
      disabled: false,
      password: false,
      clearable: false,
      showwordlimit: false,
      prefixicon: '',
      suffixicon: '',
      tagattr: '',
      parenttagattr: '',
      butsize: 'small',
      ruleslist: [],
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'textarea',
    name: '多行文本',
    icon: 'fa fa-text-height',
    options: {
      eventlist: [],
      title: '多行文本',
      defaultValue: '',
      placeholder: '',
      dataLength: '500',
      minRows: 3,
      maxRows: 1000,
      required: false,
      disabled: false,
      showwordlimit: false,
      lg: 24,
      md: 24,
      xs: 24,
      labelwidth: 80,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ruleslist: [],
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'select',
    name: '下拉列表',
    icon: 'fa fa-caret-square-o-down',
    options: {
      eventlist: [],
      title: '下拉列表',
      defaultValue: '',
      isMulty: false,
      isSearch: false,
      required: false,
      disabled: false,
      collapsetags: false,
      clearable: false,
      allowcreate: false,
      butsize: 'small',
      placeholder: '',
      filed: '',
      labelwidth: 80,
      lg: 8,
      md: 12,
      xs: 24,
      isRemote: false,
      wherelist: [],
      sourceApi: '',
      sourceName: '',
      sourcetype: '',
      labelValue: '',
      tagattr: '',
      parenttagattr: '',
      options: ['选项1', '选项2'],
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'date',
    name: '日期控件',
    icon: 'fa fa-calendar',
    options: {
      eventlist: [],
      title: '日期控件',
      placeholder: '',
      dataType: 'date',
      format: 'yyyy-MM-DD',
      lg: 8,
      md: 12,
      xs: 24,
      labelwidth: 80,
      modeltype: 'date',
      isshowtime: false,
      required: false,
      disabled: false,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'radio',
    name: '单选控件',
    icon: 'fa fa-dot-circle-o',
    options: {
      eventlist: [],
      title: '单选项',
      labelwidth: 80,
      defaultValue: '',
      filed: '',
      disabled: false,
      required: false,
      isbutton: false,
      tagattr: '',
      parenttagattr: '',
      wherelist: [],
      sourceApi: '',
      sourceName: '',
      sourcetype: '',
      labelValue: '',
      lg: 8,
      md: 12,
      xs: 24,
      isRemote: false,
      options: ['选项1', '选项2'],
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'checkbox',
    name: '多选控件',
    icon: 'fa fa-check-square-o',
    options: {
      eventlist: [],
      title: '多选项',
      labelwidth: 80,
      defaultValue: [],
      filed: '',
      disabled: false,
      required: false,
      isbutton: false,
      tagattr: '',
      parenttagattr: '',
      wherelist: [],
      sourceApi: '',
      sourceName: '',
      sourcetype: '',
      labelValue: '',
      lg: 8,
      md: 12,
      xs: 24,
      isRemote: false,
      options: ['选项1', '选项2'],
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'button',
    name: '按钮组控件',
    icon: 'fa fa-bold',
    options: {
      lg: 8,
      md: 12,
      xs: 24,
      labelwidth: 80,
      align: 'left',
      filed: '',
      tagattr: '',
      parenttagattr: '',
      buttons: [
        {
          name: '按钮',
          type: 'buttonitem',
          options: {
            eventlist: [],
            title: '按钮',
            icon: 'fa fa-check',
            butType: '',
            tagattr: '',
            parenttagattr: '',
            isplain: false,
            isround: false,
            iscircle: false,
            disabled: false,
            butsize: 'small',
          },
        },
      ],
      ishide: false,
    },
  },
  {
    type: 'switch',
    name: 'switch开关',
    icon: 'el-icon-turn-off',
    options: {
      title: 'switch开关',
      idPrefix: 'sw_',
      controlId: '',
      labelwidth: 80,
      lg: 8,
      md: 12,
      xs: 24,
      disabled: false,
      defaultValue: false,
      activecolor: '#13ce66',
      inactivecolor: '#ff4949',
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'slider',
    name: '滑块',
    icon: 'el-icon-minus',
    options: {
      title: '滑块',
      idPrefix: 'sl_',
      controlId: '',
      labelwidth: 80,
      lg: 8,
      md: 12,
      xs: 24,
      disabled: false,
      defaultValue: 1,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      min: 0,
      max: 100,
      step: 1,
      range: false,
      showstops: false,
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'colorpicker',
    name: '颜色选择',
    icon: 'fa fa-tachometer',
    options: {
      title: '颜色选择',
      idPrefix: 'sl_',
      controlId: '',
      labelwidth: 80,
      lg: 24,
      md: 24,
      xs: 24,
      disabled: false,
      defaultValue: '',
      filed: '',
      tagattr: '',
      parenttagattr: '',
      butsize: 'small',
      ishide: false,
      istitle: true,
    },
  },
  // {
  //   type: 'avatar',
  //   name: '头像',
  //   icon: 'fa fa-text-width',
  //   options: {
  //     title: '',
  //     idPrefix: 'av_',
  //     controlId: '',
  //     labelwidth: 120,
  //     lg: 24,
  //     md: 24,
  //     xs: 24,
  //     disabled: false,
  //     defaultValue:
  //       'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
  //     filed: '',
  //     tagattr: '',
  //     parenttagattr: '',
  //     butsize: 'small',
  //     fit: 'fill',
  //     shape: 'square',
  //     ishide: false,
  //   },
  //   funshow() {
  //     // if (fromInfo.designType === '/buildquestionnaire.html') {
  //     //   return false
  //     // }
  //     return false
  //   },
  // },
  {
    type: 'editor',
    name: '富文本',
    icon: 'fa fa-html5',
    options: {
      title: '富文本',
      defaultValue: '',
      placeholder: '',
      required: false,
      disabled: false,
      lg: 24,
      md: 24,
      xs: 24,
      height: 350,
      labelwidth: 80,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },

  {
    type: 'signname',
    name: '签名控件',
    icon: 'el-icon-edit',
    options: {
      title: '签名控件',
      required: false,
      disabled: false,
      lg: 24,
      md: 24,
      xs: 24,
      height: 191,
      labelwidth: 80,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'locationmap',
    name: '定位控件',
    icon: 'el-icon-s-flag',
    options: {
      title: '当前位置：',
      required: false,
      disabled: false,
      labelwidth: 80,
      lg: 24,
      md: 24,
      xs: 24,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'rate',
    name: 'rate评分',
    icon: 'fa fa-star',
    options: {
      title: 'rate评分',
      eventlist: [],
      lg: 8,
      md: 12,
      xs: 24,
      defaultValue: '',
      filed: '',
      required: false,
      disabled: false,
      labelwidth: 80,
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'inputnumber',
    name: '数字控件',
    icon: 'fa fa-sort-numeric-asc',
    options: {
      eventlist: [],
      title: '数字',
      lg: 8,
      md: 12,
      xs: 24,
      defaultValue: '1',
      filed: '',
      min: 0,
      max: 0,
      precision: 0,
      step: 1,
      required: false,
      disabled: false,
      labelwidth: 80,
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
      butsize: 'small',
    },
  },
  {
    type: 'imgage',
    name: '图片控件',
    icon: 'fa fa-picture-o',
    options: {
      eventlist: [],
      title: '图片',
      width: 150,
      height: 150,
      idPrefix: 'img_',
      describe: '',
      filed: '',
      defaultValue: '',
      tagattr: '',
      parenttagattr: '',
      lg: 8,
      md: 12,
      xs: 24,
      ishide: false,
      istitle: true,
    },
    funshow(data, fromInfo) {
      if (fromInfo.designType === '/buildquestionnaire.html') {
        return false
      }
      return true
    },
  },
  {
    type: 'timepicker',
    name: '时间选择',
    icon: 'fa fa-calendar-check-o',
    options: {
      lg: 8,
      md: 12,
      xs: 24,
      eventlist: [],
      title: '时间选择',
      timeformat: '',
      minute: 1,
      second: 1,
      required: false,
      disabled: false,
      filed: '',
      labelwidth: 80,
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'upFilesComp',
    name: '上传控件',
    icon: 'fa fa-upload',
    options: {
      title: '上传',
      lg: 8,
      md: 12,
      xs: 24,
      uptype: 'file',
      required: false,
      disabled: false,
      filed: '',
      tagattr: '',
      parenttagattr: '',
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'carouselimg',
    name: '轮播图',
    icon: 'fa fa-upload',
    options: {
      lg: 24,
      md: 24,
      xs: 24,
      imglist: ['/assets/1.png', '/assets/2.png', '/assets/3.png'],
      tagattr: '',
      parenttagattr: '',
    },
  },
  // {
  //   type: 'divider',
  //   name: '分割线',
  //   icon: 'fa fa-upload',
  //   options: {
  //     lg: 24,
  //     md: 24,
  //     xs: 24,
  //     tagattr: '',
  //     parenttagattr: '',
  //   },
  // },
]
export const platformComponents = [
  // {
  //   type: 'partlayout',
  //   name: '局部容器',
  //   icon: 'fa fa-columns',
  //   options: {
  //     lg: 8,
  //     md: 12,
  //     xs: 24,
  //     eventlist: [],
  //     title: '',
  //     columns: [],
  //     tagattr: '',
  //     ishide: false,
  //   },
  // },
  {
    type: 'listview',
    name: '子表控件',
    icon: 'el-icon-s-grid',
    options: {
      title: '子表控件',
      idPrefix: 'lst_',
      controlId: 'view1',
      enableChoose: false,
      isMulty: false,
      showNo: true,
      tagattr: '',
      columns: [],
      ishide: false,
    },
  },
  {
    type: 'gridlist',
    name: '列表查询',
    icon: 'el-icon-s-grid',
    options: {
      title: '列表查询',
      sourceName: '',
      sourceApi: '',
      sourcetype: '',
      wherelist: [],
      columns: [],
      idPrefix: 'lst_',
      controlId: 'view1',
      enableChoose: false,
      isMulty: false,
      isPage: false,
      showNo: true,
      tagattr: '',
      fromid: '',
      ishide: false,
    },
    funshow(data, fromInfo) {
      if (fromInfo.designType === '/buildquestionnaire.html') {
        return false
      }
      return false
    },
  },
  {
    type: 'user',
    name: '选人控件',
    icon: 'fa fa-user',
    options: {
      title: '选人控件',
      typemode: 1,
      idPrefix: 'usr_',
      controlId: '',
      describe: '',
      required: false,
      disabled: false,
      lg: 8,
      md: 12,
      xs: 24,
      defaultText: '',
      isMulty: false,
      confirmFunName: '',
      confirm: '',
      edit: false,
      deptId: '',
      showUserid: false,
      placeholder: '',
      init: '',
      filed: '',
      labelwidth: 80,
      tagattr: '',
      ishide: false,
      istitle: true,
    },
    funshow(data, fromInfo) {
      if (
        fromInfo.designType === '/buildquestionnaire.html' ||
        config.versiontype === 'form'
      ) {
        return false
      }
      return true
    },
  },
  {
    type: 'department',
    name: '选部门控件',
    icon: 'fa fa-users',
    options: {
      title: '选部门',
      typemode: 2,
      idPrefix: 'dep_',
      controlId: '',
      placeholder: '',
      describe: '',
      required: false,
      disabled: false,
      dataType: 'string',
      lg: 8,
      md: 12,
      xs: 24,
      isMulty: false,
      confirmFunName: '',
      confirm: '',
      edit: false,
      ActiveParameterFunName: '',
      ActiveParameter: '',
      level: '10000001',
      maxLevel: '6',
      filed: '',
      labelwidth: 80,
      tagattr: '',
      ishide: false,
      istitle: true,
    },
    funshow(data, fromInfo) {
      if (
        fromInfo.designType === '/buildquestionnaire.html' ||
        config.versiontype === 'form'
      ) {
        return false
      }
      return true
    },
  },
  {
    type: 'organ',
    name: '选机构控件',
    icon: 'fa fa-cubes',
    options: {
      title: '选机构',
      typemode: 3,
      idPrefix: 'dep_',
      controlId: '',
      placeholder: '',
      describe: '',
      required: false,
      disabled: false,
      dataType: 'string',
      lg: 8,
      md: 12,
      xs: 24,
      isMulty: false,
      confirmFunName: '',
      confirm: '',
      edit: false,
      ActiveParameterFunName: '',
      ActiveParameter: '',
      level: '10000001',
      maxLevel: '6',
      filed: '',
      labelwidth: 80,
      tagattr: '',
      ishide: false,
      istitle: true,
    },
    funshow(data, fromInfo) {
      if (
        fromInfo.designType === '/buildquestionnaire.html' ||
        config.versiontype === 'form'
      ) {
        return false
      }
      return true
    },
  },
  {
    type: 'role',
    name: '选角色控件',
    icon: 'el-icon-s-custom',
    options: {
      title: '选角色',
      typemode: 4,
      idPrefix: 'dep_',
      controlId: '',
      placeholder: '',
      describe: '',
      required: false,
      disabled: false,
      dataType: 'string',
      lg: 8,
      md: 12,
      xs: 24,
      isMulty: false,
      confirmFunName: '',
      confirm: '',
      edit: false,
      ActiveParameterFunName: '',
      ActiveParameter: '',
      level: '10000001',
      maxLevel: '6',
      filed: '',
      labelwidth: 80,
      tagattr: '',
      ishide: false,
      istitle: true,
    },
    funshow(data, fromInfo) {
      if (
        fromInfo.designType === '/buildquestionnaire.html' ||
        config.versiontype === 'form'
      ) {
        return false
      }
      return true
    },
  },
  {
    type: 'datarelevance',
    name: '关联数据',
    icon: 'el-icon-connection',
    options: {
      title: '关联数据',
      sourceName: '',
      sourceApi: '',
      sourcetype: '',
      filedList: { headname: '', bindname: '' },
      wherelist: [],
      assignFiledList: [],
      filed: '',
      defaultValue: '',
      labelwidth: 80,
      lg: 8,
      md: 12,
      xs: 24,
      isAdd: false,
      required: false,
      disabled: false,
      fromid: '',
      ishide: false,
      istitle: true,
    },
    funshow(data, fromInfo) {
      if (
        fromInfo.designType === '/buildquestionnaire.html' ||
        config.versiontype === 'form'
      ) {
        return false
      }
      return true
    },
  },
  {
    type: 'queryrelevance',
    name: '关联查询',
    icon: 'fa fa-database',
    options: {
      title: '关联查询',
      sourceName: '',
      sourceApi: '',
      sourcetype: '',
      wherelist: [],
      assignFiledList: [],
      lg: 8,
      md: 12,
      xs: 24,
      titleRow: true,
    },
    funshow(data, fromInfo) {
      if (
        fromInfo.designType === '/buildquestionnaire.html' ||
        config.versiontype === 'form'
      ) {
        return false
      }
      return true
    },
  },
  {
    type: 'cityselector',
    name: '地区选择',
    icon: 'fa fa-vcard',
    options: {
      title: '地区选择',
      filed: '',
      defaultValue: '',
      labelwidth: 80,
      lg: 8,
      md: 12,
      xs: 24,
      tagattr: '',
      required: false,
      disabled: false,
      ishide: false,
      istitle: true,
    },
  },
  {
    type: 'autonumber',
    name: '自动编号',
    icon: 'fa fa-gg',
    options: {
      title: '自动编号',
      filed: '',
      BusinessMoudle: '',
      BusinessModuleID: '',
      labelwidth: 80,
      modelcode: '',
      lg: 8,
      md: 12,
      xs: 24,
      tagattr: '',
      ishide: false,
      istitle: true,
    },
    funshow() {
      if (config.versiontype === 'form') {
        return false
      }
      return true
    },
  },
]
export const chartComponents = [
  {
    type: 'linechart',
    name: 'e折线图',
    icon: 'fa fa-user',
    dragType: 'chart',
    title: '折线图',
    options: {
      controlId: '',
      lg: 8,
      md: 8,
      xs: 8,
      height: 260,
      iconclass: 'fa fa-bar-chart',
      iconcolor: '',
      titlecolor: '',
      decorationmodel: 1,
      axisdata: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      axistype: 'x',
      tooltip: true,
      tooltip_left: 'center',
      bordermodel: 1,
    },
  },
  {
    type: 'barechart',
    name: 'e柱状图',
    icon: 'fa fa-user',
    dragType: 'chart',
    title: '柱状图',
    options: {
      controlId: '',
      lg: 8,
      md: 8,
      xs: 8,
      height: 260,
      iconclass: 'fa fa-bar-chart',
      iconcolor: '',
      titlecolor: '',
      decorationmodel: 1,
      axisdata: [],
      axistype: 'x',
      tooltip: true,
      tooltip_left: 'center',
      bordermodel: 1,
    },
  },
  {
    type: 'piechart',
    name: 'e饼图',
    icon: 'fa fa-user',
    dragType: 'chart',
    title: '饼图',
    options: {
      controlId: '',
      lg: 8,
      md: 8,
      xs: 8,
      height: 260,
      iconclass: 'fa fa-bar-chart',
      iconcolor: '',
      titlecolor: '',
      decorationmodel: 1,
      tooltip: true,
      tooltip_left: 'center',
      bordermodel: 1,
    },
  },
]
export const cotroltype = [
  {
    typename: '布局组件',
    icontype: 'layout',
    ctrllist: layoutComponents,
    draggablebind: {
      group: { name: 'layout', pull: 'clone', put: false },
      animation: 150,
      sort: false,
      ghostClass: 'ghost',
    },
  },
  {
    typename: '基础组件',
    icontype: 'basecotrl',
    ctrllist: basicComponents,
    draggablebind: {
      group: { name: 'basectrl', pull: 'clone', put: false },
      animation: 150,
      sort: false,
      ghostClass: 'ghost',
    },
  },
  {
    typename: '平台组件',
    icontype: 'platform',
    ctrllist: platformComponents,
    draggablebind: {
      group: { name: 'basectrl', pull: 'clone', put: false },
      animation: 150,
      sort: false,
      ghostClass: 'ghost',
    },
  },
  {
    typename: 'echart统计',
    icontype: 'chart',
  },
  {
    typename: '自定义组件',
    icontype: 'customcomm',
  },
]
